//
// Created by xili on 2024/8/9 21:39.
// Go big or go home.
//
#include "leetcode.h"

class Solution {
public:
    vector <string> sortPeople(vector <string> &names, vector<int> &heights) {
        map<int, string> m;
        int n = heights.size();
        for (int i = 0; i < n; i++) {
            m[heights[i]] = names[i];
        }
        vector <string> ans;
        for (auto &[h, n]: m) {
            ans.push_back(n);
        }
        reverse(ans.begin(), ans.end());
        return ans;
    }
};